package com.funny.stock.data.vo;

/**
 * @author pengl
 * @date 2020/11/08
 **/
public enum StockStatus {
    TRADING(1, "交易中"),
    TRADE_CLOSE(2, "已收盘"),
    OPEN_OFFER(3, "未开盘"),
    CLOSED(4, "休市");

    int status;
    String name;

    StockStatus(int status,String name){
        this.status = status;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public int getStatus() {
        return status;
    }

    public static StockStatus of(String status){
        StockStatus[] values = values();
        for (int i = 0; i < values.length; i++) {
            if(values[i].getName().equals(status)){
                return values[i];
            }
        }

        return CLOSED;
    }
}
